package com.jycrm.service.serve.impl;

import java.io.File;
import java.util.Iterator;
import java.util.List;

import com.jycrm.common.PagedListHolder;
import com.jycrm.dao.serve.IReckoningConversionFileDao;
import com.jycrm.dao.serve.impl.ReckoningConversionFileParam;
import com.jycrm.domain.serve.reckoning.ReckoningConversionFile;
import com.jycrm.service.serve.IReckoningConversionService;
import com.jycrm.util.CrmProperities;

public class ReckoningConversionServiceImpl implements IReckoningConversionService {

	public PagedListHolder getPagedListHolder(ReckoningConversionFileParam param,int pageSize,int pageNo) {
		PagedListHolder p= reckoningConversionFileDao.getReckoningConversionFilePagedListHolder( param,pageSize,pageNo);
		
		return p;
	}

	public void delConversionFile(List v) {
		if(v!=null){
			Iterator it = v.iterator();
			while(it.hasNext()){
				ReckoningConversionFile f = (ReckoningConversionFile) it.next();
				
				String path=CrmProperities.rootfolder+"/"+f.getPath()+f.getFileName();
				reckoningConversionFileDao.delete(f);
				File file = new File(path); 
				if(file.exists()){
					file.delete();
				}
				
				
			}
		}
		
	}
	
	
	
	private IReckoningConversionFileDao reckoningConversionFileDao;



	public void setReckoningConversionFileDao(
			IReckoningConversionFileDao reckoningConversionFileDao) {
		this.reckoningConversionFileDao = reckoningConversionFileDao;
	}
	
	

}
